<template>
    <div id="jifen">
        <div class="breadcrumb ">
          <el-breadcrumb separator-class="el-icon-arrow-right">
            <el-breadcrumb-item>
                <el-tag>会员管理</el-tag>
            </el-breadcrumb-item>
             <el-breadcrumb-item>
                <a href="http://localhost:8081/#/index/memberList"><el-tag>会员列表</el-tag></a>
              </el-breadcrumb-item>
             <el-breadcrumb-item>
                <el-tag>积分记录</el-tag>
              </el-breadcrumb-item>
          </el-breadcrumb>
        </div>
         <div class="list">
             <el-table
                :data="tableData"
                style="width: 100%"
                borde
                 height="650">
                <el-table-column
                  prop="id"
                  label="积分id"
                  width="180">
                </el-table-column>
                <el-table-column
                  prop="number"
                  label="积分">
                </el-table-column>
                <el-table-column
                  prop="leixing"
                  label="操作">
                </el-table-column>

              <el-table-column
                  prop="time"
                  label="时间">
                </el-table-column>
              </el-table>
         </div>
    </div> 
</template>
<script>
     import { getJifen } from './../../../../service/api/index.js'
     export default{
       name:"GoodsList",
            data() {
              return {
                  tableData: [],
                     search: ''
              }
            },
            
           
            
          
   
            mounted(){
                console.log(this.$route.query.token);
            },
            

            created(){
                 //请求网络数据   调用getVegetables返回promise对象，然后可以调用promise的then方法，返回请求到的数据(response.data)  
                      getJifen(this.$route.query.token).then((response)=>{
                      console.log(response);
                      if (response.success) {
                         this.tableData = response.data;
                           for(var i=0;i<(this.tableData).length;i++){
                               if (this.tableData[i].leixing===-1) {
                                  this.tableData[i].leixing='买菜抵扣';
                                  this.tableData[i].number=-this.tableData[i].number;
                               }else if (this.tableData[i].leixing===1) {
                                  this.tableData[i].leixing='支付获得';
                                  this.tableData[i].number=+this.tableData[i].number;
                               }else if (this.tableData[i].leixing===2) {
                                  this.tableData[i].leixing='采购蔬菜获得';
                                  this.tableData[i].number=+this.tableData[i].number;             
                               }
                           }
                       }
                 }).catch(error=>{
                       // todo......
                      console.log(error);
                 })   //---catch
            }, // ----created






            methods:{

            }
     }
    
</script>
<style lang="less" scope>
   #jifen{
     width:100%;
     height:100%;
     background-color:#f5f5f5;
     z-index: 99;
     position: absolute;
     top:0.1px;
     right:1px;
   }
   .breadcrumb {
     margin-right: 0.2rem;
     margin-left: 0.2rem;
     margin-top: 0.1rem;
     margin-bottom: 0.1rem;
     background-color:white;
     padding: 0.06rem;
     height:0.6rem;
     border-radius: 4px
   }
   .list{
     margin-left: 2rem;
     margin-right: 2rem;
   }
</style>